package org.gitos.cloud.domain.server;

import org.springframework.jdbc.core.RowMapper;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

public class User implements Serializable, RowMapper<User> {

    private static final long serialVersionUID = 4931046682794923526L;
    private String uuid;
    private String nickname;
    private String mobile;
    /**
     * 第三方用户唯一标识
     */
    private String openid;
    private byte[] headimg;
    private String password;
    private String gender;

    // 保留字段
    private String name;

    private String username;
    private String email;
    private Date createtime;
    private Date logintime;
    private String from;
    private int logoff;

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getNickname() {
        return nickname;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public byte[] getHeadimg() {
        return headimg;
    }

    public void setHeadimg(byte[] headimg) {
        this.headimg = headimg;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public Date getLogintime() {
        return logintime;
    }

    public void setLogintime(Date logintime) {
        this.logintime = logintime;
    }

    public int getLogoff() {
        return logoff;
    }

    public void setLogoff(int logoff) {
        this.logoff = logoff;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public void setCreatetime(String create_time) {
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    @Override
    public User mapRow(ResultSet rs, int rowNum) throws SQLException {
        User user = new User();
        user.setCreatetime(rs.getDate("create_time"));
        user.setLogintime(rs.getDate("login_time"));
        user.setEmail(rs.getString("email"));
        user.setGender(rs.getString("gender"));
        user.setHeadimg(rs.getBytes("headimg"));
        user.setMobile(rs.getString("mobile"));
        user.setName(rs.getString("name"));
        user.setNickname(rs.getString("nickname"));
        user.setPassword(rs.getString("password"));
        user.setUuid(rs.getString("uuid"));
        user.setOpenid(rs.getString("openid"));
        user.setUsername(rs.getString("username"));
        user.setFrom(rs.getString("come_from"));
        user.setLogoff(rs.getInt("logoff"));
        return user;
    }

}
